using System.Collections.Generic;
using System;
using UnityEngine;

namespace SgsUI
{
    // 属性数据结构
    public class ParamData
    {
        public string m_key;

        public int value_type;

        public int m_int;

        public float m_float;

        public string m_string;

        public Align m_align;

        public List<NodeData> m_list_data;

        public Vector2 m_vec2;

        public bool m_bool;

        public ColorData m_color;

        public string GetKey()
        {
            return m_key;
        }

        public void SetValue(string key,int value)
        {
            m_key = key;
            value_type = DataType.Int;
            m_int = value;
        }

        public void SetValue(string key,float value)
        {
            m_key = key;
            value_type = DataType.Float;
            m_float = value;
        }

        public void SetValue(string key,string value)
        {
            m_key = key;
            value_type = DataType.String;
            m_string = value;
        }

        public void SetValue(string key,List<NodeData> value)
        {
            m_key = key;
            value_type = DataType.NodeData;
            m_list_data = value;
        }

        public void SetValue(string key,Align value)
        {
            m_key = key;
            value_type = DataType.Align;
            m_align = value;
        }

        public void SetValue(string key,Vector2 value)
        {
            m_key = key;
            value_type = DataType.Vector2;
            m_vec2 = value;
        }

        public void SetValue(string key,bool value)
        {
            m_key = key;
            value_type = DataType.Bool;
            m_bool = value;
        }

        public void SetValue(string key,ColorData value)
        {
            m_key = key;
            value_type = DataType.ColorData;
            m_color = value;
        }
    }

    // 节点数据结构
    public class NodeData
    {
        public List<ParamData> m_params;

        public NodeData()
        {
            m_params = new List<ParamData>();
        }

        public void AddParam(ParamData data)
        {
            m_params.Add(data);
        }
    }
}